﻿@model IList<Nop.Admin.Models.Logistics.PlanNoteModel>
@using Nop.Core.Domain.Shipping;
@using Nop.Core.Domain.Logistics;

@if (Model.Count > 0)
{
    <br /><br />
    <table border="1">
        <tr>
            <th>@Html.LabelFor(m => m[0].CreatedOn)</th>
            <th>@Html.LabelFor(m => m[0].Action)</th>
            <th>@Html.LabelFor(m => m[0].CustomerId)</th>
            <th>@Html.LabelFor(m => m[0].PlanId)</th>
            <th>@Html.LabelFor(m => m[0].PlanStatus)</th>
            <th>@Html.LabelFor(m => m[0].PackageId)</th>
            <th>@Html.LabelFor(m => m[0].PackageStatus)</th>
            <th>@Html.LabelFor(m => m[0].LocationId)</th>
            <th>@Html.LabelFor(m => m[0].ValidForCommission)</th>
            <th>@Html.LabelFor(m => m[0].DisplayToCourier) </th>
        </tr>

        @for ( var idx = 0; idx < Model.Count(); idx++ )
        {
            var planStatusValue = (PlanStatus)Model[idx].PlanStatus;
            
            <tr>
                <td>@Html.DisplayFor(m => m[idx].CreatedOn)</td>
                <td>@Html.DisplayFor(m => m[idx].Action)</td>
                <td>@Html.DisplayFor(m => m[idx].CustomerId)</td>
                <td>@Html.ActionLink(Model[idx].PlanId.ToString(), "PlannedRouteList", new { id = Model[idx].PlanId }) </td>
                <td>@planStatusValue.ToString()</td>

                @if (Model[idx].PackageId.HasValue)
                {
                    var pkgStatusValue = (ShippingStatus)Model[idx].PackageStatus;
                    <td>@Html.DisplayFor(m => m[idx].PackageId)</td>
                    <td>@pkgStatusValue.ToString()</td>
                }
                else
                {
                    <td></td>
                    <td></td>
                }

                @if (Model[idx].LocationId.HasValue)
                {
                    <td>@Html.DisplayFor(m => m[idx].LocationId)</td>
                }
                else
                {
                    <td></td>   
                }

                <td>@Html.DisplayFor(m => m[idx].ValidForCommission)</td>
                <td>@Html.DisplayFor(m => m[idx].DisplayToCourier)</td>
            </tr>   
        } 
            
    </table>
}